/*********************************************************************
*	Author         : orbit
*	Date           : October 6, 2000
* Last-modified  : February 12, 2005 
*	Contact us     : inte2000@163.com,support@winmsg.com
*	Web Page       : http://www.winmsg.com/cn/orbit.htm (for Chinese version)
*						       http://www.winmsg.com/orbit.htm (for English version)
**********************************************************************/

#ifndef __GLOBALS_H
#define __GLOBALS_H

// size constants
#define TAB_HEIGHT              8           // slack (non text part)
#define EXTRA_TAB_ROW_HEIGHT    2            // slack for extra rows

// user messages
#define WM_UPDATETABS           (WM_USER + 0x13)

// enumerations
//##ModelId=431C34CA0251
enum SnapStates                 { ssMDI = 0, ssWindow };
//##ModelId=431C34CA0280
enum SnapOrientations           { soTop = 0, soBottom };
//##ModelId=431C34CA02BF
enum AddOrder                   { aoFront = 0, aoBack };

extern SnapStates cfg_iSnap;
extern SnapOrientations cfg_iOrientation;
extern AddOrder cfg_iAddOrder;
extern int cfg_iShellKey;
extern BOOL cfg_bShowIcons;
extern BOOL cfg_bDispRC;
extern BOOL cfg_bDispResLang;
extern BOOL cfg_bDispResType;
extern BOOL cfg_bDispRID;
extern BOOL cfg_bNoShellContext;
extern BOOL cfg_bUseWindowLimit;
extern int cfg_iWindowLimit;

// class declarations
class CDSWindow;
class CTabBarsWnd;
class CDevStudioWnd;
class CDS_MDIWnd;
class CTabManagerWindow;

// global variables
extern CWinApp *                pTheApp;
extern CTabManagerWindow *      pGlobalActiveManager;
extern CDSWindow *              pGlobalActiveDSWindow;
extern CDS_MDIWnd *             pGlobalMDIManager;
extern CTabBarsWnd *            pGlobalTabs;

extern CDevStudioWnd* g_pDevStudioWnd;      // DevStudio main window
extern long           g_dwCookie;
extern TCHAR					g_szIniPathName[MAX_PATH];
extern CString				g_strPrjSetFile;
extern TCHAR					g_szHeadType[128];
extern TCHAR					g_szCPPType[128];
extern CStringArray		g_strAFlipPath;
extern BOOL						g_bAddTime;
extern BOOL						g_bAddUser;
extern BOOL						g_bAutoSave;
extern int						g_nSaveTimeSpan;
extern TCHAR					g_szUser[32];

//##ModelId=431C34CA02EE
enum DVEditor { Main = 1, Text = 2, Dialog = 4, Image = 8 };
//extern LPCTSTR g_szEdNames[];
extern LPCTSTR lpszCommandWnd;
// Inform DevStudio of the commands we implement

  // two rules for commands: 
  // 1. the method name must be the command name
  // 2. the commands must appear below in the order of their toolbar 
  //    buttons

//##ModelId=431C34CA030D
struct cmd 
{ 
	//##ModelId=431C34CA031D
  LPCTSTR szCommand; 
	//##ModelId=431C34CA032C
  int     sCmdString; 
};

extern LPCTSTR g_szHotkeyItem[];
extern cmd g_toolbar_cmds[];
const int nCommandItem = 11;


//Ini config file section name
extern LPCTSTR lpszGeneral;
extern LPCTSTR lpszMainIfo;
extern LPCTSTR lpszTabbar;
extern LPCTSTR lpszFlip;
extern LPCTSTR lpszToolbar;
extern LPCTSTR lpszZip;

//Ini config file item name
extern LPCTSTR lpszSaveLog;
extern LPCTSTR lpszShowIcon;
extern LPCTSTR lpszEnableShellMenu;
extern LPCTSTR lpszLimitWnd;
extern LPCTSTR lpszShowRcName;
extern LPCTSTR lpszShowRcLang;
extern LPCTSTR lpszShowRcType;
extern LPCTSTR lpszShowRcID;
extern LPCTSTR lpszMaxWnd;
extern LPCTSTR lpszOrderBy;
extern LPCTSTR lpszInitPos;
extern LPCTSTR lpszAddTime;
extern LPCTSTR lpszAddUser;
extern LPCTSTR lpszUser;
extern LPCTSTR lpszNull;
extern LPCTSTR lpszAutoSave;
extern LPCTSTR lpszTimeSpan;
extern LPCTSTR lpszFlipPath;
extern LPCTSTR lpszHeadType;
extern LPCTSTR lpszCppType;
extern LPCTSTR lpszSelectPortion;

//message box title
extern LPCTSTR lpszMsgBoxTitle;
// misc
//#define PACKVERSION(major, minor) MAKELONG(minor, major)
#define countof(arr)  (sizeof(arr)/sizeof(arr[0]))

// find a DevStudio child window:
extern HWND GetHWND(LPCTSTR cTitle);        
extern HWND GetHWND(CComBSTR& bStr);
extern HWND GetHWND(IGenericWindow *pWindow);

// returns version information about a specified file
extern CString LoadVersionString(LPCTSTR path);

extern void SplitString(CString & strMultiLine,CStringArray & strAMultistr);
extern void CombineString(const CStringArray & strAMultistr,CString & strMultiLine);
extern void InitGlobalVar();
extern int  SplitFileTypeString(LPCTSTR lpszTypeString,CStringArray & arTypes,LPCTSTR lpszSepMark = _T(";"));

/*
// VC5 compatible replace function
inline void CString_Replace(CString& cStr, LPCTSTR cToReplace, 
                            LPCTSTR cWithWhat)
{
    int nPos = cStr.Find(cToReplace);
    if (nPos >= 0)
    {
        CString cRight = cStr.Mid(nPos + _tcslen(cToReplace));
        cStr = cStr.Left(nPos);
        cStr += cWithWhat + cRight;
    }
}
*/
#endif  // __GLOBALS_H
